home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- import java.util.SortedSet;
- import java.util.TreeSet;
-
- public class GC$LatencyRequest implements Comparable {
- private static long counter = 0L;
- private static SortedSet requests = null;
- private long latency;
- // $FF: renamed from: id long
- private long field_0;
-
- private static void adjustLatencyIfNeeded() {
- if (requests != null && !requests.isEmpty()) {
- GC$LatencyRequest var0 = (GC$LatencyRequest)requests.first();
- if (var0.latency != GC.access$200()) {
- GC.access$500(var0.latency);
- }
- } else if (GC.access$200() != Long.MAX_VALUE) {
- GC.access$500(Long.MAX_VALUE);
- }
-
- }
-
- private GC$LatencyRequest(long var1) {
- if (var1 <= 0L) {
- throw new IllegalArgumentException("Non-positive latency: " + var1);
- } else {
- this.latency = var1;
- synchronized(GC.access$100()) {
- this.field_0 = ++counter;
- if (requests == null) {
- requests = new TreeSet();
- }
-
- requests.add(this);
- adjustLatencyIfNeeded();
- }
- }
- }
-
- public void cancel() {
- synchronized(GC.access$100()) {
- if (this.latency == Long.MAX_VALUE) {
- throw new IllegalStateException("Request already cancelled");
- } else if (!requests.remove(this)) {
- throw new InternalError("Latency request " + this + " not found");
- } else {
- if (requests.isEmpty()) {
- requests = null;
- }
-
- this.latency = Long.MAX_VALUE;
- adjustLatencyIfNeeded();
- }
- }
- }
-
- public int compareTo(Object var1) {
- GC$LatencyRequest var2 = (GC$LatencyRequest)var1;
- long var3 = this.latency - var2.latency;
- if (var3 == 0L) {
- var3 = this.field_0 - var2.field_0;
- }
-
- return var3 < 0L ? -1 : (var3 > 0L ? 1 : 0);
- }
-
- public String toString() {
- return GC$LatencyRequest.class.getName() + "[" + this.latency + "," + this.field_0 + "]";
- }
-
- // $FF: synthetic method
- GC$LatencyRequest(long var1, GC.1 var3) {
- this(var1);
- }
- }
-